package com.rabbitMq.testlate.controller;

import com.rabbitMq.testlate.config.RabbitMqConfig;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageBuilder;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SendRabbitMq {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    @PostMapping("/wang")
    public void wang(){
        rabbitTemplate.convertAndSend(RabbitMqConfig.RABBITMQ_EXCHANGE_VALUE,RabbitMqConfig.RABBITMQ_ROUTER_VALUE,"wangming");
    }
}
